﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Controls;
using System.Windows.Media.Imaging;
namespace BombermanGameEditorBeta
{
    class MapBox
    {
        private Image m_ImageElement;
        private EnumTypes m_Type;


        public MapBox()
        {
            //do nothing
            //m_Type = EnumTypes.BLANK;
        }
        public MapBox(Image i, EnumTypes t)
        {
            m_ImageElement = i;
            m_Type = t;
            setImageElementUI(m_Type);
        }

        public Image imageElement
        {
            get
            {
                return m_ImageElement;
            }
            set
            {
                m_ImageElement = value;
            }
        }
        public EnumTypes type
        {
            get
            {
                return m_Type;
            }
            set
            {
                if (value != m_Type)
                {
                    m_Type = value;
                    setImageElementUI(m_Type);
                }
            }
        }




        private void setImageElementUI(EnumTypes t)
        {
            string typesImageName = "";
            switch (t)
            {
                case EnumTypes.LANDSCAPE:
                    typesImageName = "landscape";
                    break;
                case EnumTypes.BOX:
                    typesImageName = "box";
                    break;
                case EnumTypes.ENEMY:
                    typesImageName = "enemy";
                    break;
                case EnumTypes.HERO:
                    typesImageName = "hero";
                    break;
                case EnumTypes.WALL:
                    typesImageName = "wall";
                    break;
                case EnumTypes.BLANK:
                    typesImageName = "blank";
                    break;

            }

            m_ImageElement.Source = new BitmapImage(new Uri(@"UIResource/"+typesImageName+".png", UriKind.Relative));
                
        }
    }
}
